package club.zhilin.guli.service.trade.feign;

import club.zhilin.guli.common.base.result.CommonResult;
import club.zhilin.guli.service.base.dto.CourseDTO;
import club.zhilin.guli.service.trade.feign.fallback.IEduCourseServiceImpl;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

/**
 * @author zhilin
 * @since 2022/3/1 16:24
 */
@FeignClient(value = "service-edu")
@SentinelResource(fallbackClass = IEduCourseServiceImpl.class)
public interface IEduCourseService {

    /**
     * 根据课程id查询courseDTO
     *
     * @param courseId 课程id
     * @return commonResult
     */
    @GetMapping("/portal/edu/course/inner/course/{courseId}")
    CommonResult<CourseDTO> selectCourseDTO(@PathVariable("courseId") String courseId);

    /**
     * 远程调用edu中courseController的方法更新课程销量
     *
     * @param courseId 课程id
     * @return commonResult
     */
    @PutMapping("/portal/edu/course/update/course/{courseId}")
    CommonResult<String> updateCourseBuyCount(@PathVariable String courseId);
}
